package com.iot.manage.service;

import com.alibaba.fastjson.JSONObject;
import com.iot.manage.dao.DeviceServiceMapper;
import com.iot.manage.pojo.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceServiceService {

    @Autowired
    private DeviceServiceMapper deviceServiceMapper;

    public List<DeviceService> findDeviceServiceList(String query, int pagenum, int pagesize) {
        return deviceServiceMapper.findDeviceServiceList(query,pagesize * (pagenum - 1),pagesize * pagenum);
    }

    public int countDeviceServiceList(String query) {
        return deviceServiceMapper.countDeviceServiceList(query);
    }

    public void addDeviceServiceInfo(JSONObject params) {
        deviceServiceMapper.addDeviceServiceInfo(params);
    }

    public DeviceService findDeviceServiceInfoByIdOrCode(String params) {
        return deviceServiceMapper.findDeviceServiceInfoByIdOrCode(params);
    }

    public void updateDeviceServiceInfo(JSONObject params) {
        deviceServiceMapper.updateDeviceServiceInfo(params);
    }

    public void deleteDeviceServiceInfo(String dserviceId) {
        deviceServiceMapper.deleteDeviceServiceInfo(dserviceId);
    }

    public int countServiceUseTotal(String dserviceCode) {
        return deviceServiceMapper.countServiceUseTotal(dserviceCode);
    }

    public void updateDeviceModelArg(JSONObject params) {
        deviceServiceMapper.updateDeviceModelArg(params);
    }
}
